cmake_minimum_required(VERSION 3.20)

project(find_Qt VERSION 0.1.1 LANGUAGES CXX DESCRIPTION "Hello Qt" )

set(CMAKE_CXX_STANDARD 17)

message(STATUS "project name: ${PROJECT_NAME}")
message(STATUS "project source dir: ${PROJECT_SOURCE_DIR}")
message(STATUS "project binary dir: ${PROJECT_BINARY_DIR}")
message(STATUS "Is top level? ${PROJECT_IS_TOP_LEVEL}")
message(STATUS "project version: ${PROJECT_VERSION}")

# -- 查找OpenCV库
find_package(OpenCV REQUIRED)
# 输出OpenCVConfig.cmake中的变量
message(STATUS "OpenCV Version ${OpenCV_VERSION}")
message(STATUS "OpenCV_LIBS ${OpenCV_LIBS}")
message(STATUS "OpenCV_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS}")


# -- 查找Qt库
find_package(Qt6 6.4.2 EXACT COMPONENTS Widgets REQUIRED)
message(STATUS "Qt6_DIR = ${Qt6_DIR}")

add_executable(main main.cpp)
if(MSVC)
    message(STATUS "MSVC")
    target_compile_options(main PRIVATE "/Zc:__cplusplus")
    target_compile_options(main PRIVATE "/permissive-")
    target_compile_options(main PRIVATE "/utf-8")
endif()

target_link_libraries(main ${OpenCV_LIBS} Qt6::Widgets)
